package com.eighth.observer.origin;


public class TestDemo2 {
    public static void main(String[] args) {
        MessageInfo messageInfo = new MessageInfo();
        UserInfo user1 = new UserInfo("Lucy");
        UserInfo user2 = new UserInfo("Andy");
        UserInfo user3 = new UserInfo("Tim");

        messageInfo.addObserver(user1);
        messageInfo.addObserver(user2);
        messageInfo.addObserver(user3);
        messageInfo.setMessage("亲们，么么哒");

        messageInfo.deleteObserver(user2);
        messageInfo.setMessage("韩梅梅和李雷！你们结婚了吗？");
    }
}
